<?php
// 初始化签的列表
$signs = [
    "大吉，近期诸事顺遂，好运连连！",
    "中吉，会有小惊喜降临，把握机会。",
    "小吉，生活平稳，偶有小确幸。",
    "凶，需谨慎行事，避免意外。",
    "无吉无凶，一切照旧，平淡也是福。"
];

// 处理抽签请求
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // 随机抽取一个签
    $randomIndex = array_rand($signs);
    $result = $signs[$randomIndex];
}
?>

<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>抽签网页游戏</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            background-color: #f4f4f4;
        }

        h1 {
            color: #333;
        }

        form {
            margin-top: 20px;
        }

        button {
            padding: 10px 20px;
            font-size: 16px;
            background-color: #007BFF;
            color: white;
            border: none;
            cursor: pointer;
            border-radius: 5px;
        }

        button:hover {
            background-color: #0056b3;
        }

        #result {
            margin-top: 20px;
            font-size: 18px;
            color: #333;
        }
    </style>
</head>

<body>
    <h1>抽签网页游戏</h1>
    <form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
        <button type="submit">抽签</button>
    </form>
    <?php
    if (isset($result)) {
        echo '<div id="result">您抽到的签是：' . $result. '</div>';
    }
    ?>
</body>

</html>